package com.hb.trade.server.project.evaluation.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hb.core.pojo.project.evaluation.dto.EvaluationReviewItemParam;
import com.hb.core.pojo.project.evaluation.dto.EvaluationSecondDTO;
import com.hb.core.pojo.project.evaluation.entity.EvaluationSecond;
import com.hb.core.pojo.project.evaluation.vo.EvaluationResultSummaryVO;
import org.fzzn.core.model.msg.Message;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 专家二级评审表 服务类
 * </p>
 *
 * @author jinhaolin
 * @since 2022-04-13
 */
public interface EvaluationSecondService extends IService<EvaluationSecond> {

    /**
     * 根据标段id、专家id 和 二级评审项id 获取二级评审项结果
     * @param sectionId
     * @param expertId
     * @return
     */
    List<EvaluationSecond> findBySectionIdAndExpertIdAndSecondId(Long sectionId, Long expertId, Long secondReviewItemId);

    /**
     * 根据标段id 和 二级评审项id 获取二级评审项结果
     * @param sectionId
     * @param secondReviewItemId
     * @return
     */
    List<EvaluationSecond> findBySectionIdAndSecondId(Long sectionId, Long secondReviewItemId);

    /**
     * 获取汇总结果
     * @param evaluationReviewItemParam
     * @return
     */
    EvaluationResultSummaryVO resultSummaryInfo(EvaluationReviewItemParam evaluationReviewItemParam);

    /**
     * 是否可以进行汇总
     * @param evaluationReviewItemParam
     * @return
     */
    Boolean canResultSummary(EvaluationReviewItemParam evaluationReviewItemParam);

    /**
     * 确认汇总
     * @param evaluationReviewItemParam
     * @return
     */
    Boolean confirmResultSummary(EvaluationReviewItemParam evaluationReviewItemParam);

    /**
     * 复核
     * @param
     * @return
     */
    Boolean recheckResultSummary(Long sectionId, Long reviewItemId);

    /**
     * 初始化评审状态
     *
     * @param sectionId
     * @param secondReviewItemId
     * @return java.lang.Boolean
     * @author tian
     * @date 2022-4-23 11:47
     */
    Boolean initialResultSummary(Long sectionId, Long secondReviewItemId);

    /**
     * 修改专家对应三级评审点的得分和状态
     * @author tian
     * @date 2022-4-20 15:52
     * @param evaluationSecond
     * @return java.lang.Integer
     */
    Integer updateFinalScoreByExpertIdAndSecondReviewItemId(EvaluationSecond evaluationSecond);


    /**
     * 更新定性评审状态
     * @param evaluationSecond
     * @return
     */
    Integer updateApproveFlagByExpertIdAndSecondReviewItemId(EvaluationSecond evaluationSecond);

    /**
     * 查询专家报价信息提交状态
     * @author tian
     * @date 2022-4-20 17:14
     * @param evaluationReviewItemParam
     * @return org.fzzn.core.model.msg.Message<java.util.List<com.hb.core.pojo.project.evaluation.dto.EvaluationSecondDTO>>
     */
    Message<List<EvaluationSecondDTO>> selectOfferReview(EvaluationReviewItemParam evaluationReviewItemParam);
    /**
     *
     * @Description:根据二级评审点获得未被淘汰的公司
     * @Author: zhongdl
     * @Date:2022/4/20 10:33
     * @param sectionId:
     * @param secondReviewItemId:
     * @return: {@link List< Long> }
     **/
    List<EvaluationSecond> listNotEliminate(Long sectionId, Long secondReviewItemId);
     /**
     *
     * @Description:根据标段id和评审项类型获得所有的二级评审点
     * @Author: zhongdl
     * @Date:2022/4/20 10:33
     * @param sectionId:
     * @param  firstReviewItemType:
     * @return: {@link List< Long> }
     **/
    List<EvaluationSecond> listEvaluationSecond(Long sectionId, Integer firstReviewItemType);


    /**
     * 查询最终汇总详情
     *
     * @param evaluationReviewItemParam
     * @return org.fzzn.core.model.msg.Message<java.util.Map>
     * @author tian
     * @date 2022-4-21 15:24
     */
    Message<Map> finalSummaryReview(EvaluationReviewItemParam evaluationReviewItemParam);


    /**
     * 查询专家是否对报价评审确认
     * @author tian
     * @date 2022-4-20 17:19
     * @param expertId
     * @param sectionId
     * @param secondReviewItemId
     * @return java.lang.Integer
     */
    Integer countByEvaluationStatus(Long expertId, Long sectionId, Long secondReviewItemId);

    /**
     * 更新企业的淘汰状态
     * @param sectionId
     * @param reviewItemId
     * @param idList
     * @return
     */
    Boolean saveOrgEliminateStatus(Long sectionId, Long reviewItemId, List<Long> idList);

    /**
     * 取消企业淘汰状态
     * @param sectionId
     * @param reviewItemId
     * @return
     */
    Boolean cancelOrgEliminateStatus(Long sectionId, Long reviewItemId);


    /**
     * @param sectionId:标段状态
     * @param evaluationStatusList: 评标状态 1，未开始；2，评标中；3，已结束
     * @Description:获得二级评审项评审状态的数量
     * @Author: zhongdl
     * @Date:2022/5/10 9:43

     * @return: {@link int }
     **/
    int getEvaluationStatusCount(Long sectionId,List<Integer> evaluationStatusList);
}
